println!("test");
assert_that(p.cargo("test").arg("-vj1"),
execs().with_status(0)
- .with_stdout("\
+ .with_stderr("\
[COMPILING] foo v0.5.0 (file://[..])
[RUNNING] `[..]build-script-build[..]`
[RUNNING] `rustc [..] --crate-name foo [..]`
[RUNNING] `rustc [..] --crate-name foo [..]`
[RUNNING] `[..]foo-[..][..]`
-
+[DOCTEST] foo
+[RUNNING] `rustdoc --test [..]`")
+ .with_stdout("
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-[DOCTEST] foo
-[RUNNING] `rustdoc --test [..]`
running 0 tests
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0)
- .with_stdout("\
+ .with_stderr("\
[COMPILING] b v0.5.0 (file://[..])
[RUNNING] `rustc [..] --crate-name b [..]`
[COMPILING] a v0.5.0 (file://[..])
"#);
assert_that(p.cargo_process("run"),
execs().with_status(0)
- .with_stdout("\
+ .with_stderr("\
[COMPILING] foo v0.5.0 (file://[..])
-[RUNNING] `target[..]foo`
+[RUNNING] `target[..]foo`")
+ .with_stdout("\
Hello, World!
"));
fn test_bar() {}
"#);
assert_that(p.cargo_process("test").arg("-v"),
- execs().with_stdout(format!("\
+ execs().with_stderr(format!("\
[COMPILING] foo v0.0.1 ({dir})
[RUNNING] [..] build.rs [..]
[RUNNING] [..]build-script-build[..]
[RUNNING] [..] --cfg foo[..]
[RUNNING] [..] --cfg foo[..]
[RUNNING] [..]foo-[..]
-
+[RUNNING] [..]test-[..]
+[DOCTEST] foo
+[RUNNING] [..] --cfg foo[..]", dir = p.url()))
+ .with_stdout("
running 1 test
test test_foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-[RUNNING] [..]test-[..]
running 1 test
test test_bar ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-[DOCTEST] foo
-[RUNNING] [..] --cfg foo[..]
running 1 test
test foo_0 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", dir = p.url())));
+"));
});
test!(cfg_doc {
fn test_bar() {}
"#);
assert_that(p.cargo_process("test").arg("-v"),
- execs().with_stdout(format!("\
+ execs().with_stderr(format!("\
[COMPILING] foo v0.0.1 ({dir})
[RUNNING] `[..]`
[RUNNING] `[..]`
[RUNNING] `[..]`
[RUNNING] [..]foo-[..]
-
+[RUNNING] [..]test-[..]
+[DOCTEST] foo
+[RUNNING] [..] --cfg foo[..]", dir = p.url()))
+ .with_stdout("
running 1 test
test test_foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-[RUNNING] [..]test-[..]
running 1 test
test test_bar ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-[DOCTEST] foo
-[RUNNING] [..] --cfg foo[..]
running 1 test
test foo_0 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", dir = p.url())));
+"));
});
test!(cfg_override_doc {
"#);
assert_that(p.cargo_process("test").arg("-v").arg("--test=foo"),
- execs().with_status(0).with_stdout("\
+ execs().with_status(0)
+ .with_stderr("\
[COMPILING] a v0.5.0 ([..]
[RUNNING] `rustc a[..]build.rs [..]`
[RUNNING] `[..]build-script-build[..]`
[COMPILING] foo v0.5.0 ([..]
[RUNNING] `rustc src[..]lib.rs [..] -L test[..]`
[RUNNING] `rustc tests[..]foo.rs [..] -L test[..]`
-[RUNNING] `[..]foo-[..]`
-
+[RUNNING] `[..]foo-[..]`")
+ .with_stdout("
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
"));
assert_that(p.cargo("test").arg("-v").arg("-pb").arg("--lib"),
- execs().with_status(0).with_stdout("\
+ execs().with_status(0)
+ .with_stderr("\
[FRESH] a v0.5.0 ([..]
[COMPILING] b v0.5.0 ([..]
[RUNNING] `rustc b[..]src[..]lib.rs [..] -L test[..]`
-[RUNNING] `[..]b-[..]`
-
+[RUNNING] `[..]b-[..]`")
+ .with_stdout("
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
// First time around we should compile both foo and bar
assert_that(p.cargo_process("build"),
- execs().with_stdout(&format!("\
+ execs().with_stderr(&format!("\
[UPDATING] git repository `{git}`
[COMPILING] bar v0.5.0 ({git}#[..])
[COMPILING] [..] v0.5.0 ([..])
// Make sure we still only compile one version of the git repo
println!("build");
assert_that(p.cargo("build"),
- execs().with_stdout(&format!("\
+ execs().with_stderr(&format!("\
[COMPILING] bar v0.5.0 ({git}#[..])
[COMPILING] [..] v0.5.0 ({dir}[..]dep[..])
[COMPILING] [..] v0.5.0 ({dir}[..]dep[..])
// Make sure we use the previous resolution of `bar` instead of updating it
// a second time.
assert_that(p.cargo("test"),
- execs().with_stdout("\
+ execs().with_stderr("\
[COMPILING] [..] v0.5.0 ([..])
[COMPILING] [..] v0.5.0 ([..]
-[RUNNING] target[..]foo-[..]
-
+[RUNNING] target[..]foo-[..]")
+ .with_stdout("
running 1 test
test tests::foo ... ok
assert_that(p.cargo("test"),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stderr(&format!("\
[COMPILING] [..] v0.5.0 ({url}[..])
[COMPILING] [..] v0.5.0 ({url}[..])
-[RUNNING] target[..]foo-[..]
-
+[RUNNING] target[..]foo-[..]", url = p.url()))
+ .with_stdout("
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", url = p.url())));
+"));
});
test!(custom_target_no_rebuild {
let target = alternate();
assert_that(p.cargo_process("test").arg("--target").arg(&target),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stderr(&format!("\
[COMPILING] foo v0.0.0 ({foo})
[RUNNING] target[..]{triple}[..]bar-[..]
-
+[RUNNING] target[..]{triple}[..]foo-[..]", foo = p.url(), triple = target))
+ .with_stdout("
running 1 test
test test ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-[RUNNING] target[..]{triple}[..]foo-[..]
running 1 test
test test_foo ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
-", foo = p.url(), triple = target)));
+"));
});
test!(no_cross_doctests {
let target = alternate();
assert_that(p.cargo_process("test").arg("--target").arg(&target),
execs().with_status(0)
- .with_stdout(&format!("\
+ .with_stderr(&format!("\
[COMPILING] foo v0.0.0 ({foo})
-[RUNNING] target[..]{triple}[..]foo-[..]
-
+[RUNNING] target[..]{triple}[..]foo-[..]", foo = p.url(), triple = target))
+ .with_stdout("
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
-", foo = p.url(), triple = target)));
+"));
});
test!(simple_cargo_run {
assert_that(p.cargo("test"),
execs().with_stderr(format!("\
[COMPILING] foo v0.5.0 ({url})
-[RUNNING] target[..]foo-[..]", url = p.url()))
+[RUNNING] target[..]foo-[..]
+[ERROR] test failed", url = p.url()))
.with_stdout_contains("
running 1 test
test test_hello ... FAILED
p.build();
assert_that(p.cargo("test").arg("--doc"),
- execs().with_status(0).with_stdout(&format!("\
+ execs().with_status(0)
+ .with_stderr(&format!("\
[COMPILING] foo v0.0.1 ([..])
-[DOCTEST] foo
-
+[DOCTEST] foo"))
+ .with_stdout("
running 1 test
test bar_0 ... ok
test result: ok.[..]
-")));
+"));
});